package com.sp2.dev.test.listener;

import java.util.ArrayList;

/**
 * Created by IntelliJ IDEA.
 * User: zhimingli
 * Date: 14-2-10
 * Time: 下午1:46
 * To change this template use File | Settings | File Templates.
 */

//战队控制中心类：目标类 
public abstract class AllyControlCenter {
    protected String allyName;//战队名称

    //定义1个集合存储战队队员
    protected ArrayList<Observer> players = new ArrayList<Observer>();

    public String getAllyName() {
        return allyName;
    }

    public void setAllyName(String allyName) {
        this.allyName = allyName;
    }

    public void join(Observer obs){
        System.out.println(obs.getName()+" 加入 "+this.getAllyName()+"战队  ");
        players.add(obs);
    }

    //注销方法
    public void quit(Observer obs) {
        System.out.println(obs.getName() + "退出" + this.allyName + "战队！");
        players.remove(obs);
    }

     //声明抽象通知方法
    public abstract void notifyObserver(String name);  
}
